<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>优惠券管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$('#my').click(function(){
				if(confirm('你确定？')){
					alert(1)
				}
			})
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
			return false;
		}
		
		
		
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/cupons/tCupons/list">优惠券列表</a></li>
		<li><a href="${ctx}/cupons/tCupons/add">优惠券添加</a></li>
	</ul>
	 <form:form id="searchForm" modelAttribute="tCupons" action="${admin}/cupons/tCupons/list" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<sys:tableSort id="orderBy" name="orderBy" value="${page.orderBy}" callback="page();"/>
		
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th><a href="${ctx}/cupons/tCupons/list">所有优惠券</a></th>
				<th><a href="${ctx}/cupons/tCupons/list?state=1">未开始</a></th>
				<th><a href="${ctx}/cupons/tCupons/list?state=2">进行中</a></th>
				<th><a href="${ctx}/cupons/tCupons/list?state=3">已结束</a></th>
			</tr>
		</thead>
	</table>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>优惠券名称</th>
				<th>价值</th>
				<th>最低消费</th>
				<th>领取限制</th>
				<th>库存</th>
				<th>有效期</th>
				<th>领取人次</th>
				<th>已使用</th>
			    <th>操作</th>
			</tr>
		</thead>
		<c:forEach items="${page.list}" var="CuponsInfo">
			<tr>
				<td>${CuponsInfo.name}</td>
				<c:if test="${CuponsInfo.type==0}">
				<td>${CuponsInfo.price} 元</td>
				</c:if>
				<c:if test="${CuponsInfo.type==1}">
				<td>${CuponsInfo.price} 折</td>
				</c:if>
				<td>${CuponsInfo.minPrice} </td>
				<td>${CuponsInfo.limit == '0'?'无' : CuponsInfo.limit }</td>
				<td>${CuponsInfo.stock} </td>
				<c:if test="${CuponsInfo.dateType==0}">
				<td><fmt:formatDate value="${CuponsInfo.timeBegin}" pattern="yyyy-MM-dd" />   至   <fmt:formatDate value="${CuponsInfo.timeOver}" pattern="yyyy-MM-dd" /></td>
				</c:if>
				<c:if test="${CuponsInfo.dateType!=0}">
				<td>${CuponsInfo.dateLimit} 天</td>
				</c:if>
				<td><a href="${ctx}/cupons/tCupons/pick?cuponsId=${CuponsInfo.cuponsId}"> ${CuponsInfo.pickNum}</a></td>
				<td><a href="${ctx}/cupons/tCupons/use?cuponsId=${CuponsInfo.cuponsId}"> ${CuponsInfo.useNum}</a></td>
				<td>
				<c:if test="${CuponsInfo.isDisable==1}" >
				    <span ><a  href="${ctx}/cupons/tCupons/form?cuponsId=${CuponsInfo.cuponsId}">编辑</a></span>
					<span ><a  href="${ctx}/cupons/tCupons/drop?cuponsId=${CuponsInfo.cuponsId}" onclick="return confirmx('确认要让该优惠券失效吗？', this.href)">使失效</a></span>
				</c:if>
				<c:if test="${CuponsInfo.isDisable==0}" >
				已失效
				</c:if>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>